<template>
  <div class="new-tab-page middle-box">
    <div
      class="page-main-title middle-header"
    >{{ query.merchantId !== undefined ? '修改账号资料' : '申请开通-支付宝支付' }}<i class="return-icon" @click="back"></i></div>

    <div v-if="currentTab === '主要信息'" @goStep="goStep" class="add-account-form zfb-request">
      <el-form
        ref="addAccountForm"
        label-width="110px"
        label-position="left"
        :model="merchantInfo"
        :rules="rules"
        class="addAccount-form"
        size="small"
      >
        <div class="form-item">
          <div class="item-title form-header">主要信息</div>
          <div class="item-bd">
            <el-form-item label="支付宝账号" prop="merchantMail" required>
              <el-input v-model="merchantInfo.merchantMail" placeholder="支付宝账号（必填）"></el-input>
              <span class="weblink-to">
                如无支付宝账号，请先注册
                <a
                  href="https://memberprod.alipay.com/account/reg/index.htm"
                  target="_blank"
                >注册地址</a>
              </span>
            </el-form-item>
            <el-form-item label="PID" prop="mchId">
              <el-input v-model="merchantInfo.mchId" placeholder="2088*********"></el-input>
              <span class="weblink-to tip">
                <el-button type="text" @click="PIDtipVisible = true">什么是PID?</el-button>
              </span>
              <el-dialog
                title="什么是PID"
                :visible.sync="PIDtipVisible"
                width="720px"
                :before-close="handlePIDClose"
              >
                <div class="weblink-to inside-tip tip-step">
                  1、登录
                  <a
                    href="https://openhome.alipay.com/platform/keyManage.htm?keyType=partner"
                    target="_blank"
                  >https://openhome.alipay.com/platform/keyManage.htm?keyType=partner</a>（需要登录）
                </div>
                <div class="tip-step">2、“合作伙伴身份”就可以看到我们所需要查询的PID，以2088开头的16位纯数字</div>
                <img src="../../../assets/img/pid-tip.jpg" alt />
                <span slot="footer" class="dialog-footer hide">
                  <el-button @click="PIDtipVisible = false">取 消</el-button>
                  <el-button type="primary" @click="PIDtipVisible = false">确 定</el-button>
                </span>
              </el-dialog>
            </el-form-item>
            <el-form-item label="企业名称" prop="businessName" required>
              <el-input v-model="merchantInfo.businessName" placeholder="企业名称（必填）"></el-input>
            </el-form-item>
            <el-form-item label="信用代码" prop="businessLicenseCode" required>
              <el-input v-model="merchantInfo.businessLicenseCode" placeholder="信用代码（必填）"></el-input>
            </el-form-item>
            <el-form-item label="联系人" prop="name" required>
              <el-input v-model="merchantInfo.name" placeholder="联系人姓名（必填）"></el-input>
              <el-tooltip class="item" content="商户微信支付业务联系人的真实姓名，微信签约时会进行实名认证" placement="right">
                <i class="el-icon-question more-icon"></i>
              </el-tooltip>
            </el-form-item>
            <el-form-item label="手机号码" prop="phone" required>
              <el-input v-model="merchantInfo.phone" type="tel" placeholder="手机号码（必填）"></el-input>
              <el-tooltip
                class="item"
                content="用于接收微信支付的重要管理信息及日常操作验证码，微信签约时会进行短信验证"
                placement="right"
              >
                <i class="el-icon-question more-icon"></i>
              </el-tooltip>
            </el-form-item>
            <el-form-item label="联系邮箱" prop="email" required>
              <el-input v-model="merchantInfo.email" placeholder="常用邮箱（必填）" type="email"></el-input>
              <el-tooltip class="item" content="用于接收微信/支付宝的审核通知结果" placement="right">
                <i class="el-icon-question more-icon"></i>
              </el-tooltip>
            </el-form-item>
            <el-form-item size="medium" class="action-box" label-width="0px">
              <el-button type="primary" @click="savePayMerchantInfo">提交</el-button>
              <el-button type="primary" plain @click="back" style="margin-left: 40px">取消</el-button>
            </el-form-item>
          </div>
        </div>
      </el-form>
    </div>

    <!-- <Protocol envirement="1" @goStep="goStep" v-if="currentTab === '车场协议'"></Protocol> -->
  </div>
</template>

<script src="./index.js"></script>

<style lang="less" scoped>
@import "./index.less";
</style>

<style lang="less">
.page-main-title {
  &.middle-header {
    padding-left: 40px;
  }
}
.add-account-form {
  &.zfb-request {
    padding: 4px 40px 34px 40px;
    .form-header {
      height: 44px;
      background: #f2f2f2;
      line-height: 44px;
      padding-left: 20px;
      font-size: 14px;
    }
    .form-item {
      border: 1px solid #f2f2f2;
      font-size: 14px;
    }
    .item-bd {
      padding: 31px 0 0 21px;
    }
    .el-input {
      &.el-input--small {
        width: 320px !important;
      }
    }
    .weblink-to {
      margin-left: 12px;
      a {
        margin-left: 6px;
        color: #5995d8;
      }
      &.tip {
        margin-left: 10px;
        a {
          margin-left: 0px;
        }
      }
      &.inside-tip {
        margin-left: 0px;
      }
    }
    .agreen {
      font-size: 14px;
      color: #666666;
      margin-top: 30px;
      .protocol-link {
        font-size: 14px;
        color: #5995d8;
        margin-left: 4px;
      }
    }
    .action-box {
      margin: 25px 0 41px 21px;
    }
    .el-form-item--small {
      &.el-form-item {
        margin-bottom: 20px;
      }
    }
    .el-dialog {
      border-radius: 4px;
      .tip-step {
        margin-bottom: 30px;
      }
      .el-dialog__header {
        padding: 0;
        padding-left: 20px;
        height: 40px;
        line-height: 40px;
        border-radius: 4px;
        background: #f4f4f4;
        font-weight: bold;
        color: #383838;
        .el-dialog__title {
          font-size: 14px;
          line-height: 10px;
        }
      }
      .el-dialog__body {
        padding: 30px 50px;
        color: #474747;
        img {
          width: 620px;
          height: 255px;
        }
      }
      .el-dialog__headerbtn {
        top: 14px;
        .el-dialog__close {
          color: #555;
          font-weight: bold;
        }
      }
    }
  }
  .el-form-item {
    &.is-required:not(.is-no-asterisk) > .el-form-item__label:before {
      position: absolute;
      top: 3px;
      left: 2px;
    }
    .el-form-item__label {
      position: relative;
      padding-left: 22px;
    }

    .upload-item {
      line-height: 0;
      .el-upload-list + .el-upload {
        transition: display 0.3s ease-in-out 0.3s;
      }
      &.is-uploaded {
        .el-upload-list + .el-upload {
          display: none;
        }
      }
      &:not(.is-uploaded) {
        .el-upload-list {
          display: none;
        }
      }
      .el-upload--picture-card {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        line-height: 1.4;
      }
      .el-upload-list--picture-card {
        line-height: 0;
        .el-upload-list__item {
          margin-bottom: 0;
        }
      }
    }

    .upload-item.is-uploaded {
      .el-upload-list + .el-upload {
        display: none;
      }
    }
    .el-form-item__content {
      display: flex;
      align-items: flex-start;

      .el-input,
      .el-textarea,
      .upload-item {
        width: 270px;
        // min-width: 270px;
      }

      .btn-group {
        .upload-item {
          width: 148px;
          flex: 1;
        }
      }
    }
  }
}
</style>
